from xigua_downloader import *
from multiprocessing.dummy import Pool
import re

if __name__ == "__main__":
    video_id = []
    with open("./log.txt", 'r', encoding='utf8') as fp:
        video_log = fp.readlines()
        
    video_id = re.findall(r"(\d+) 下载失败", str(video_log))
    print(len(video_id))
    
    pool = Pool(4)
    downloader = xigua_downloader()        
    pool.map(downloader.run, video_id)
    pool.close()
    pool.join()